package Frames;

/**
 *
 * @author Enrique
 */

import java.awt.Toolkit;
import utilitarios.Data;
import javax.swing.*;
import org.jvnet.substance.SubstanceDefaultLookAndFeel;


public class VentanaPrincipal extends javax.swing.JFrame {

    /**
     * Creates new form VentanaPrincipal
     */
    
    Data mostrar_datos;
    // guardamos en el string el nombre del la ubicacion de la clase del look and feel correspondiente
    
    
    public VentanaPrincipal() {
        initComponents();
        Toolkit t= Toolkit.getDefaultToolkit();
        setIconImage(t.getImage(getClass().getResource("table.png")));
        mostrar_datos = new Data();
        mostrar_datos.elDato();
        lbl_data.setText("Hoy es "+ mostrar_datos.dia_semana + " " + mostrar_datos.dia+" de "+ mostrar_datos.mes
                         + " del año " + mostrar_datos.año);
        timer1.start();
        
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        timer1 = new org.netbeans.examples.lib.timerbean.Timer();
        jLabel1 = new javax.swing.JLabel();
        lbl_data = new javax.swing.JLabel();
        lbl_hora = new javax.swing.JLabel();
        btn_cliente = new javax.swing.JButton();
        btn_Venta = new javax.swing.JButton();
        btn_Usuarios = new javax.swing.JButton();
        jMenuBar1 = new javax.swing.JMenuBar();
        menu_registros = new javax.swing.JMenu();
        miten_cliente = new javax.swing.JMenuItem();
        jSeparator1 = new javax.swing.JPopupMenu.Separator();
        miten_funcionarios = new javax.swing.JMenuItem();
        jSeparator3 = new javax.swing.JPopupMenu.Separator();
        miten_proveedores = new javax.swing.JMenuItem();
        jSeparator5 = new javax.swing.JPopupMenu.Separator();
        miten_producto = new javax.swing.JMenuItem();
        jSeparator6 = new javax.swing.JPopupMenu.Separator();
        miten_salir = new javax.swing.JMenuItem();
        menu_movimiento = new javax.swing.JMenu();
        miten_ventas = new javax.swing.JMenuItem();
        jMenuItem1 = new javax.swing.JMenuItem();
        miten_presupuesto = new javax.swing.JMenuItem();
        menu_reportes = new javax.swing.JMenu();
        miten_reportedeventas = new javax.swing.JMenuItem();
        jMenuItem2 = new javax.swing.JMenuItem();
        menu_seguridad = new javax.swing.JMenu();
        miten_contraseña = new javax.swing.JMenuItem();
        miten_nivelacceso = new javax.swing.JMenuItem();

        timer1.addTimerListener(new org.netbeans.examples.lib.timerbean.TimerListener() {
            public void onTime(java.awt.event.ActionEvent evt) {
                timer1OnTime(evt);
            }
        });

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setTitle("Prototipo Sistema de Control de Stock");
        setResizable(false);

        jLabel1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/graficos/john2.jpg"))); // NOI18N

        lbl_data.setText("Fecha:");

        lbl_hora.setText("Hora:");

        btn_cliente.setIcon(new javax.swing.ImageIcon(getClass().getResource("/graficos/user-32.png"))); // NOI18N
        btn_cliente.setText("Cliente");
        btn_cliente.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btn_clienteActionPerformed(evt);
            }
        });

        btn_Venta.setText("Venta");
        btn_Venta.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btn_VentaActionPerformed(evt);
            }
        });

        btn_Usuarios.setText("Usuarios");
        btn_Usuarios.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btn_UsuariosActionPerformed(evt);
            }
        });

        menu_registros.setMnemonic('r');
        menu_registros.setText("Registros");

        miten_cliente.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_C, java.awt.event.InputEvent.ALT_MASK | java.awt.event.InputEvent.CTRL_MASK));
        miten_cliente.setIcon(new javax.swing.ImageIcon(getClass().getResource("/graficos/clientes.png"))); // NOI18N
        miten_cliente.setMnemonic('c');
        miten_cliente.setText("Cliente");
        miten_cliente.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                miten_clienteActionPerformed(evt);
            }
        });
        menu_registros.add(miten_cliente);
        menu_registros.add(jSeparator1);

        miten_funcionarios.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_F, java.awt.event.InputEvent.ALT_MASK));
        miten_funcionarios.setIcon(new javax.swing.ImageIcon(getClass().getResource("/graficos/funcionario.png"))); // NOI18N
        miten_funcionarios.setMnemonic('f');
        miten_funcionarios.setText("Usuarios");
        miten_funcionarios.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                miten_funcionariosActionPerformed(evt);
            }
        });
        menu_registros.add(miten_funcionarios);
        menu_registros.add(jSeparator3);

        miten_proveedores.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_P, java.awt.event.InputEvent.ALT_MASK));
        miten_proveedores.setIcon(new javax.swing.ImageIcon(getClass().getResource("/graficos/user-32.png"))); // NOI18N
        miten_proveedores.setMnemonic('p');
        miten_proveedores.setText("Proveedores");
        menu_registros.add(miten_proveedores);
        menu_registros.add(jSeparator5);

        miten_producto.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_P, java.awt.event.InputEvent.ALT_MASK | java.awt.event.InputEvent.CTRL_MASK));
        miten_producto.setIcon(new javax.swing.ImageIcon(getClass().getResource("/graficos/folder_camera.png"))); // NOI18N
        miten_producto.setText("Productos");
        miten_producto.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                miten_productoActionPerformed(evt);
            }
        });
        menu_registros.add(miten_producto);
        menu_registros.add(jSeparator6);

        miten_salir.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_S, java.awt.event.InputEvent.CTRL_MASK));
        miten_salir.setIcon(new javax.swing.ImageIcon(getClass().getResource("/graficos/salir.png"))); // NOI18N
        miten_salir.setMnemonic('a');
        miten_salir.setText("Salir");
        miten_salir.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                miten_salirActionPerformed(evt);
            }
        });
        menu_registros.add(miten_salir);

        jMenuBar1.add(menu_registros);

        menu_movimiento.setMnemonic('m');
        menu_movimiento.setText("Movimiento");

        miten_ventas.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_V, java.awt.event.InputEvent.SHIFT_MASK));
        miten_ventas.setIcon(new javax.swing.ImageIcon(getClass().getResource("/graficos/getmoney.png"))); // NOI18N
        miten_ventas.setText("Ventas");
        miten_ventas.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                miten_ventasActionPerformed(evt);
            }
        });
        menu_movimiento.add(miten_ventas);

        jMenuItem1.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_M, java.awt.event.InputEvent.CTRL_MASK));
        jMenuItem1.setText("Compras");
        jMenuItem1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem1ActionPerformed(evt);
            }
        });
        menu_movimiento.add(jMenuItem1);

        miten_presupuesto.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_O, java.awt.event.InputEvent.CTRL_MASK));
        miten_presupuesto.setIcon(new javax.swing.ImageIcon(getClass().getResource("/graficos/money.png"))); // NOI18N
        miten_presupuesto.setText("Presupuesto");
        menu_movimiento.add(miten_presupuesto);

        jMenuBar1.add(menu_movimiento);

        menu_reportes.setMnemonic('e');
        menu_reportes.setText("Reportes");

        miten_reportedeventas.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_V, java.awt.event.InputEvent.ALT_MASK));
        miten_reportedeventas.setIcon(new javax.swing.ImageIcon(getClass().getResource("/graficos/relatorio.png"))); // NOI18N
        miten_reportedeventas.setText("Reporte de Ventas");
        menu_reportes.add(miten_reportedeventas);

        jMenuItem2.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_C, java.awt.event.InputEvent.ALT_MASK));
        jMenuItem2.setText("Reporte de Compras");
        menu_reportes.add(jMenuItem2);

        jMenuBar1.add(menu_reportes);

        menu_seguridad.setMnemonic('s');
        menu_seguridad.setText("Seguridad");

        miten_contraseña.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_A, java.awt.event.InputEvent.CTRL_MASK));
        miten_contraseña.setIcon(new javax.swing.ImageIcon(getClass().getResource("/graficos/lock.png"))); // NOI18N
        miten_contraseña.setText("Cambiar contraseña actual");
        miten_contraseña.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                miten_contraseñaActionPerformed(evt);
            }
        });
        menu_seguridad.add(miten_contraseña);

        miten_nivelacceso.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_N, java.awt.event.InputEvent.CTRL_MASK));
        miten_nivelacceso.setIcon(new javax.swing.ImageIcon(getClass().getResource("/graficos/key_delete.png"))); // NOI18N
        miten_nivelacceso.setText("Nivel de acceso");
        menu_seguridad.add(miten_nivelacceso);

        jMenuBar1.add(menu_seguridad);

        setJMenuBar(jMenuBar1);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGap(60, 60, 60)
                .addComponent(btn_cliente)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addComponent(btn_Venta, javax.swing.GroupLayout.PREFERRED_SIZE, 89, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(121, 121, 121)
                .addComponent(btn_Usuarios)
                .addGap(86, 86, 86))
            .addGroup(layout.createSequentialGroup()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addGap(18, 18, 18)
                        .addComponent(jLabel1))
                    .addGroup(layout.createSequentialGroup()
                        .addGap(111, 111, 111)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(lbl_data)
                            .addComponent(lbl_hora))))
                .addContainerGap(22, Short.MAX_VALUE))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGap(43, 43, 43)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(btn_cliente)
                    .addComponent(btn_Venta, javax.swing.GroupLayout.PREFERRED_SIZE, 29, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(btn_Usuarios, javax.swing.GroupLayout.PREFERRED_SIZE, 29, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 375, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addComponent(lbl_data)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(lbl_hora)
                .addGap(43, 43, 43))
        );

        pack();
        setLocationRelativeTo(null);
    }// </editor-fold>//GEN-END:initComponents

    private void miten_salirActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_miten_salirActionPerformed
        int salir = JOptionPane.showConfirmDialog(this, "Esta seguro de salir?", "SALIR", JOptionPane.YES_NO_OPTION);
        
        if(salir == 0){
            //System.exit(0);
            System.exit(0);
        }
    }//GEN-LAST:event_miten_salirActionPerformed

    private void timer1OnTime(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_timer1OnTime
        
        mostrar_datos.leerHora();
        lbl_hora.setText("Hora actual: " + mostrar_datos.hora);
    }//GEN-LAST:event_timer1OnTime

    private void miten_productoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_miten_productoActionPerformed
       String args[] = new String[1];
       args[0] = "Registro de Productos";
       Productos.main(args);
    }//GEN-LAST:event_miten_productoActionPerformed

    private void miten_ventasActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_miten_ventasActionPerformed
        Ventas vent = new Ventas();
        vent.setVisible(true);
    }//GEN-LAST:event_miten_ventasActionPerformed

    private void miten_contraseñaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_miten_contraseñaActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_miten_contraseñaActionPerformed

    private void miten_clienteActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_miten_clienteActionPerformed
        
       String args[] = new String[1];
       args[0] = "Registro de Clientes";
       ClienteFrame.main(args);
        
    }//GEN-LAST:event_miten_clienteActionPerformed

    private void jMenuItem1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem1ActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_jMenuItem1ActionPerformed

    private void miten_funcionariosActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_miten_funcionariosActionPerformed
       String args[] = new String[1];
       args[0] = "Registro de Funcionarios";
       Usuarios.main(args); 
    }//GEN-LAST:event_miten_funcionariosActionPerformed

    private void btn_UsuariosActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btn_UsuariosActionPerformed
       String args[] = new String[1];
       args[0] = "Registro de Funcionarios";
       Usuarios.main(args); 
    }//GEN-LAST:event_btn_UsuariosActionPerformed

    private void btn_clienteActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btn_clienteActionPerformed
       String args[] = new String[1];
       args[0] = "Registro de Clientes";
       ClienteFrame.main(args);
    }//GEN-LAST:event_btn_clienteActionPerformed

    private void btn_VentaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btn_VentaActionPerformed
        Ventas vent = new Ventas();
        vent.setVisible(true);
    }//GEN-LAST:event_btn_VentaActionPerformed

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        /* Set the Nimbus look and feel */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
         * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
         */
         try { 
					
            SubstanceDefaultLookAndFeel.setSkin("org.jvnet.substance.skin.MistAquaSkin");
            SubstanceDefaultLookAndFeel.setCurrentTheme("org.jvnet.substance.theme.SubstanceSteelBlueTheme");//tema
            SubstanceDefaultLookAndFeel.setCurrentWatermark("org.jvnet.substance.watermark.SubstanceNoneWatermark");//fondo por defecto aqui se puede colocar un imagen si deseamos
        }
        catch(Exception e){}
        
        //</editor-fold>

        /* Create and display the form */
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new VentanaPrincipal().setVisible(true);
            }
        });
    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton btn_Usuarios;
    private javax.swing.JButton btn_Venta;
    private javax.swing.JButton btn_cliente;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JMenuBar jMenuBar1;
    private javax.swing.JMenuItem jMenuItem1;
    private javax.swing.JMenuItem jMenuItem2;
    private javax.swing.JPopupMenu.Separator jSeparator1;
    private javax.swing.JPopupMenu.Separator jSeparator3;
    private javax.swing.JPopupMenu.Separator jSeparator5;
    private javax.swing.JPopupMenu.Separator jSeparator6;
    private javax.swing.JLabel lbl_data;
    private javax.swing.JLabel lbl_hora;
    private javax.swing.JMenu menu_movimiento;
    private javax.swing.JMenu menu_registros;
    private javax.swing.JMenu menu_reportes;
    private javax.swing.JMenu menu_seguridad;
    private javax.swing.JMenuItem miten_cliente;
    private javax.swing.JMenuItem miten_contraseña;
    private javax.swing.JMenuItem miten_funcionarios;
    private javax.swing.JMenuItem miten_nivelacceso;
    private javax.swing.JMenuItem miten_presupuesto;
    private javax.swing.JMenuItem miten_producto;
    private javax.swing.JMenuItem miten_proveedores;
    private javax.swing.JMenuItem miten_reportedeventas;
    private javax.swing.JMenuItem miten_salir;
    private javax.swing.JMenuItem miten_ventas;
    private org.netbeans.examples.lib.timerbean.Timer timer1;
    // End of variables declaration//GEN-END:variables

    
     
}